package com.vm.activity;

import com.vm.activity.UpdateDialog.ClickListenerInterface;
import com.wwt.app.R;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.util.DisplayMetrics;
import android.view.LayoutInflater;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.TextView;

public class WarningDialog extends Dialog{
	private Context context;
	private ClickListenerInterface clickListenerInterface;
	public WarningDialog(Context context) {
		super(context,R.layout.warningdialog);
		this.context=context;
		// TODO Auto-generated constructor stub
	}
	public interface ClickListenerInterface {
		public void doConfirm();
	}
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		init();
	}
	public void init() {
		LayoutInflater inflater = LayoutInflater.from(context);
		View view = inflater.inflate(R.layout.warningdialog, null);
		setContentView(view);
		TextView tv_warning1=(TextView)view.findViewById(R.id.tv_warning1);
		tv_warning1.setOnClickListener(new clickListener());
		Window dialogWindow = getWindow();
		WindowManager.LayoutParams lp = dialogWindow.getAttributes();
		DisplayMetrics d = context.getResources().getDisplayMetrics(); // 获取屏幕宽、高用
		lp.width = (int) (d.widthPixels * 0.8);
		lp.height=540;
	}
	public void setClicklistener(ClickListenerInterface clickListenerInterface) {
		this.clickListenerInterface = clickListenerInterface;
	}
	private class clickListener implements View.OnClickListener {

		@Override
		public void onClick(View v) {
			// TODO Auto-generated method stub
			clickListenerInterface.doConfirm();
		}
		
	}
}